import 'package:shared_preferences/shared_preferences.dart';

class SharedPreferencesUtils {
  /// 存储数据
  /// [key]    标签
  /// [value]  存储数据值
  static void saveInt(String key, int value) async {
    SharedPreferences preferences = await SharedPreferences.getInstance();
    await preferences.setInt(key, value);
  }

  /// 获取数据
  /// [key]    标签
  /// 返回[key]对应存储的数据
  static Future<int> getInt(String key) async {
    SharedPreferences preferences = await SharedPreferences.getInstance();
    int num = preferences.getInt(key);
    return num;
  }
}
